﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace sales.forms
{
    public partial class saleCopyDataOption : application.forms.copyDataOptions
    {
        public saleCopyDataOption()
        {
            InitializeComponent();
            dataKeyEd.isToUpperCase = true;
            mySalePriceOptionEnable = true;
        }

        public class OptionInfoSALE : OptionInfo
        {
            public bool WithSalePrice = true;
        }

        public override object GetOptions()
        {
            OptionInfoSALE info = new OptionInfoSALE();
            info.SelectedTypeIndex = dataTypeCb.SelectedIndex;
            info.DataKey = dataKeyEd.Text.Trim();
            info.isAppendToData = withAppendChk.Checked;
            info.WithSalePrice = withSalePriceChk.Checked;
            return info;
        }
        public override void SetOptions(object info)
        {
            OptionInfoSALE value = (OptionInfoSALE)info;
            dataTypeCb.SelectedIndex = (value.SelectedTypeIndex >= 0 && value.SelectedTypeIndex < dataTypeCb.Items.Count ? value.SelectedTypeIndex : -1);
            dataKeyEd.Text = value.DataKey;
            withSalePriceChk.Checked = value.WithSalePrice;
            withAppendChk.Checked = value.isAppendToData;
        }
        public bool mySalePriceOptionEnable
        {
            set
            {
                withSalePriceChk.Enabled = value;
            }
            get
            {
                return withSalePriceChk.Enabled;
            }
        }
    }
}
